

import static org.junit.Assert.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

/**
 * The test class RoomTest.
 *
 * @author  (your name)
 * @version (a version number or a date)
 */
public class RoomTest
{
    private Room mainRoom;
    private QuestItem questItem;
    private Consumeable potion;
    private TeleportRoom teleport1;
    private Player player1;

    /**
     * Default constructor for test class RoomTest
     */
    public RoomTest()
    {
    }

    /**
     * Sets up the test fixture.
     *
     * Called before every test case method.
     */
    @Before
    public void setUp()
    {
        mainRoom = new Room("mainRoom");
        questItem = new QuestItem("The key", "the key to... something", 10, 10);
        potion = new Consumeable("potion", "A nice shiney potion", 10, 25);
        mainRoom.addItem(questItem);
        mainRoom.addItem(potion);
        teleport1 = new TeleportRoom("a teleportah");
        mainRoom.setExit("north", teleport1);
        player1 = new Player("The dud3", 200, 100, 100, mainRoom);
    }

    /**
     * Tears down the test fixture.
     *
     * Called after every test case method.
     */
    @After
    public void tearDown()
    {
    }


    @Test
    public void addItem()
    {
        Room room1 = new Room("testRoom");
        Item item1 = new Item("itemName", "itemDescription", 10, 10);
        room1.addItem(item1);
        assertNotNull(room1.getItem("itemName"));
        assertEquals("itemDescription", room1.getItemDescription("itemName"));
        assertEquals("Located items: itemName 10\n", room1.getItemOverview());
        assertEquals(10, room1.getItemStrength("itemName"));
        assertEquals(10, room1.getItemWeight("itemName"));
        assertEquals(true, room1.hasItem("itemName"));
        room1.removeItem("itemName");
        assertEquals(false, room1.hasItem("itemName"));
    }

    @Test
    public void testExitLock()
    {
        questItem.getName();
        mainRoom.lockExit("north", "the key");
        assertEquals(true, player1.unlock("north", "the key"));
        assertEquals(false, player1.unlock("north", "the keyzz"));
    }
}




